
// src/pages/CreateVM/Step3Storage.tsx
import React from 'react';
import { Form, InputNumber, Input, Select } from 'antd';
import { VMConfig } from './CreateVMWizard';

interface Step3Props {
  config: VMConfig;
  updateConfig: (updates: Partial<VMConfig>) => void;
}

const Step3Storage: React.FC<Step3Props> = ({ config, updateConfig }) => {
  return (
    <Form layout="vertical">
      <Form.Item label="磁盘大小 (GB)" required>
        <InputNumber
          min={1}
          max={1000}
          value={config.diskSize}
          onChange={(value) => updateConfig({ diskSize: value || 20 })}
          addonAfter="GB"
          style={{ width: '200px' }}
        />
      </Form.Item>

      <Form.Item label="存储池">
        <Select
          value={config.storagePool}
          onChange={(value) => updateConfig({ storagePool: value })}
        >
          <Select.Option value="default">default</Select.Option>
          <Select.Option value="images">images</Select.Option>
        </Select>
      </Form.Item>

      <Form.Item label="磁盘路径（可选）">
        <Input
          value={config.diskPath}
          onChange={(e) => updateConfig({ diskPath: e.target.value })}
          placeholder="留空则自动生成"
        />
      </Form.Item>
    </Form>
  );
};

export default Step3Storage;